<template>
	<view class="trading">
		<view class="trading-buy-list">
			<block v-for="(item, index) in mySellIngList" :key="index">
				<view class="tbl-item">
					<view class="item buy-type one">
						{{ item.states.stateTime }}
					</view>
					<view class="item">{{ item.nums }}</view>
					<view class="item">{{ item.price }}</view>
					<view class="item">{{ item.totalPrice }}</view>
					<view class="item" :class="item.states.color">{{ item.states.name }}</view>
					<view class="item color6" v-if="item.state > 1" @tap="details(item.id)">{{item.state !== 5 ? '详情' : ''}}</view>
				</view>
			</block>
			<view class="load-more-end">
				没有更多数据
			</view>
		</view>
	</view>
</template>

<script>
import { tradingState } from '../../../../../common/utils/state.js'
export default {
	props: {
		activeTAB: {
			type: Number
		}
	},
	data() {
		return {
			mySellIngList: []
		};
	},
	methods: {
		mySellIng() {
			uni.showLoading({
				title: ''
			});
			this.$http.mySellIng().then(res => {
				uni.hideLoading();
				const data = res.data;
				if (data.success) {
					data.data.forEach(e => {
						e.states = tradingState(e.state, e)
					})
					this.mySellIngList = data.data;
					return;
				}
				uni.showToast({
					title: data.errMsg,
					icon: 'none'
				});
			});
		},
		details(id) {
			uni.navigateTo({
				url: '/pages/trading/record/sell/details?id=' + id
			})
		}
	}
};
</script>

<style scoped lang="scss">
@import './tabs.scss';
</style>
